<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        onload = function () {
            let interId = setInterval(fun1,1000);
        }

        let i = 5;
        function fun1() {
            i--;
            let sp = document.getElementById("spId");
            sp.innerText = i;
            if(i == 0){
                clearInterval("interId");
                location.href = "http://www.itheima.com";
            }
        }
    </script>
</head>
<body>
    <h1>支付成功,<span id="spId">5</span>秒后跳转到黑马官网</h1>
</body>
</html>